<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('扫码录入')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
<!--        <button onclick="reset2()">ccccccccc</button>-->
        <div class="btn-group-sm" id="toolbar" role="group">
            <a readonly class="btn btn-primary" style="font-size: large">
                <i readonly class="fa"></i> 未出库单据
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "xiaoshouchuku/chukuTest";
        function reset2() {
            $.modal.openTab('扫码录入','/xiaoshouchuku/chukuTest/selectAll',true)
        }
        $(function() {
            var options = {
                url: prefix + "/list2WeiZhiXing",
                modalName: "销售出库未执行",
                columns: [
                    //     {
                    //     checkbox: true
                    // },
                    {
                        field: 'id',
                        title: '编号',
                        visible: false
                    },
                    {
                        title: '发货通知单',
                        formatter: function(value, row, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-success btn-xs" ' +
                                'href="javascript:void(0)" onclick="DanJuShow('+row.id+')">' +
                                '<i class="fa fa-edit"></i>出库通知单</a> ');
                            return actions.join('');
                        }
                    },
                    {
                        field: 'chukuDanhao',
                        title: '出库单号'
                    },
                    {
                        field: 'fahuoDanhao',
                        title: '发货单号'
                    },
                    {
                        field: 'chukuDate',
                        title: '销售日期'
                    },
                    {
                        field: 'xiangmuName',
                        title: '项目名称'
                    },
                    {
                        field: 'xiangmuMen',
                        title: '业务员'
                    },
                    {
                        field: 'fahuoRen',
                        title: '发货人'
                    },
                    {
                        field: 'peitao1',
                        title: '配套类型'
                    },
                    {
                        field: 'goodNameMen1',
                        title: '门扇名称'
                    },
                    {
                        field: 'kaiXiang1',
                        title: '开向'
                    },
                    {
                        field: 'men1Shuliang',
                        title: '门扇数量'
                    },
                    {
                        field: 'kuangShuliang',
                        title: '门框数量'
                    },
                    {
                        field: 'shuliang1',
                        title: '防火锁数'
                    },
                    {
                        field: 'shuliang2',
                        title: '闭门器数'
                    },
                    {
                        field: 'shuliang3',
                        title: '拉爆盖数'
                    },
                    {
                        field: 'beizhu1',
                        title: '门扇备注'
                    },
                    {
                        field: 'zhonjine',
                        title: '销售金额'
                    },
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function(value, row, index) {
                            var actions = [];
                                actions.push('<a class="btn btn-success btn-xs" ' +
                                    'href="javascript:void(0)" ' +
                                    'onclick="SomeOneSaoMa('+ row.id +')">' +
                                    '<i class="fa fa-remove"></i>整单出库</a>');
                            return actions.join('');
                        }
                    }
                    ]
            };
            $.table.init(options);
        });

        function DanJuShow(id) {
            $.ajax({
                type:"get",
                datatype: "string",
                url: "/xiaoshouchuku/chukuTest/showOne/"+id,
                data: {},
                async:false,//是否是异步请求
                success: function (result) {
                    if (result.code === 0) {
                        $.modal.open('出库通知单','/xiaoshouchuku/chukuTest/showOne',1000,800)
                    }else {
                        alert("单据详细未找到")
                    }
                    // document.getElementById("msg2saoma").value = ""
                    // document.getElementById("msg2saoma").focus()
                },
                error : function() {
                    alert("后台响应出现问题");
                }
            });
        }
        function SomeOneSaoMa(id) {
            $.ajax({
                type:"POST",
                datatype: "string",
                url: "/xiaoshouchuku/SaoMaTest/selectOne/"+id,
                data: {},
                async:false,//是否是异步请求
                success: function (result) {
                    console.log(result)
                    if (result.code===0) {
                        $.modal.openTab('开始扫码','/xiaoshouchuku/SaoMaTest/selectOne',true)
                    }else {
                        alert("单据详细未找到")
                    }
                    // document.getElementById("msg2saoma").value = ""
                    // document.getElementById("msg2saoma").focus()
                },
                error : function() {
                    alert("后台响应出现问题");
                }
            });
        }
        // var prefix = ctx + "xiaoshouchuku/chukuTest"
        // $("#form-chukuTest-add").validate({
        //     focusCleanup: true
        // });

        // function submitHandler() {
        //     if ($.validate.form()) {
        //         $.operate.save(prefix + "/add", $('#form-chukuTest-add').serialize());
        //     }
        // }

        // $("input[name='chukuDate']").datetimepicker({
        //     format: "yyyy-mm-dd",
        //     minView: "month",
        //     autoclose: true
        // });


    </script>
</body>
</html>